package trident.wordcount;

import org.apache.storm.trident.operation.*;
import org.apache.storm.trident.tuple.TridentTuple;
import org.apache.storm.tuple.Values;

public class SplitFunction extends BaseFunction {
    @Override
    public void execute(TridentTuple tuple, TridentCollector collector) {
        String sentence = tuple.getStringByField("sentence");
        String[] split = sentence.split(" ");
        for (String word : split) {
            collector.emit(new Values(word));
        }
    }
}
